package com.yihu.wlyy.repository;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.yihu.wlyy.entity.consult.ConsultMoViReferral;

public interface ConsultMoViReferralDao extends PagingAndSortingRepository<ConsultMoViReferral, Long>, JpaSpecificationExecutor<ConsultMoViReferral> {
	
	@Query("select a from ConsultMoViReferral a where a.to = ?1 and a.consult = ?2")
	ConsultMoViReferral findDoctorReferral(String doctor, String consult);
	
	//查询最后处理的医生标识
	@Query("select a.to from ConsultMoViReferral a where a.consult = ?1 and a.flag = 0")
	String findToDoctor(String consult);
}
